<?php get_instance()->view('common/header');?>
<body class="bag3">
<div class="div1" style="display: block">
    <div class="weui-cells mt075">
        <a class="weui-cell weui-cell_access " href="javascript:;">
            <div class="weui-cell__bd">
                <p class="f08">头像</p>
            </div>
            <form action="<?php echo getUrl('user/portrait')?>" id="portrait" method="post" enctype="multipart/form-data">
                <div class="weui-cell__ft f08 oh pr">
                    <img src="<?php echo $info['portrait']['xs']?>" class="minuserimg f09" alt="">
                    <input type="file" style="position: absolute;left: 0;top:0;width: 100%;opacity:0;" class="portrait" name="portrait">
                </div>
                <button class="b"></button>
            </form>
            <script type="text/javascript">
                $(function () {
                    $(".portrait").change(function () {
                        $("#portrait").submit();
                    });

                    $.e_validate.init('#portrait',{saveMessage:'上传中...',successCallback:function(data){
                        $("#portrait").find('img').attr('src', data);
                    }})
                })
            </script>
        </a>
        <a class="weui-cell weui-cell_access saveNickname" href="javascript:;">
            <div class="weui-cell__bd">
                <p class="f08">昵称</p>
            </div>
            <div class="f08 nickname">
                <?php echo $info['nickname']?>
            </div>
            <div class="weui-cell__ft f08"></div>
        </a>
        <div class="weui-cell weui-cell_access">
            <div class="weui-cell__bd">
                <span class="f08">手机号</span>
            </div>
            <div class="f08 cor6"><?php echo $info['mobile']?></div>
        </div>
    </div>
    <div class="weui-cells mt075">
        <a class="weui-cell weui-cell_access " href="<?php echo getUrl('user/savePasswd')?>">
            <div class="weui-cell__bd">
                <p class="f08">登录密码</p>
            </div>
            <div class="weui-cell__ft f08"></div>
        </a>
        <a class="weui-cell weui-cell_access " href="<?php echo getUrl('user/savePayPasswd')?>">
            <div class="weui-cell__bd">
                <p class="f08">支付密码</p>
            </div>
            <div class="weui-cell__ft f08"></div>
        </a>
    </div>
</div>
<div class="div2" style="display: none">
    <form action="<?php echo getUrl('user/save')?>" id="save-form" method="post">
        <!--<div class="vCenter bag1">
            <img class="mr10 back" src="<?php echo $this->staticUrl;?>img/png/pic138.png" alt="">
        </div>-->
        <div class="weui-cells mb20">
            <div class="weui-cell weui-cell_access">
<!--                <div class="weui-cell__bd">-->
<!--                    <span style="vertical-align: middle" class="f08" data-name="nickname">昵称</span>-->
<!--                </div>-->
                <div class="f08"><input class="weui-input" type="text" placeholder="请输入用户名" name="nickname"></div>
            </div>
        </div>
        <button class="kbtn">保存</button>
    </form>
    <script type="text/javascript">
        $(function () {
            /**
             * 修改昵称
             */
            $(".saveNickname").on('click', function () {
                $("[name='nickname']").val('');
                $(".div1").hide();
                $(".div2").show();
            });

            /**
             * 返回
             */
            $(".back").on('click', function () {
                $(".div1").show();
                $(".div2").hide();
            });

            $.e_validate.init('#save-form',{saveMessage:'保存中...',successCallback:function(data){
                $(".div1").show();
                $(".div2").hide();
                $(".nickname").html($("[name='nickname']").val())
            }})
        })
    </script>
</div>
</body>
<script src="<?php echo $this->staticUrl?>js/base.js"></script>
</html>